﻿using System;
using System.Collections.Generic;
using System.Text;
using SLF.Log4netFacade;
using Slf.Resolvers;

namespace Slf.Samples.Log4NetToFile
{
  class Program
  {
    static void Main(string[] args)
    {
      // configure the logger service so that it uses a log4net factory
      // in order to supply ILogger instances.
      LoggerService.FactoryResolver = new SimpleFactoryResolver(
        new Log4netLoggerFactory());

      // The Log4netLoggerFactory above will configure the log4net 
      // framework by inspecting the application configureation file
      // 'App.config' - or 'Web.config' in the case of web applications.
      // Look at the App.config file for this project to see how
      // log4net is configured to log to files.

      // See the log4net documentation for more details:
      // http://logging.apache.org/log4net/release/manual/configuration.html

      DoSomeWork();
      Console.ReadLine();
    }


    private static void DoSomeWork()
    {
      ILogger logger = LoggerService.GetLogger("Logger.Name");
      logger.Info("Sample entry created {0}", DateTime.Now);
      Console.Write("Wrote log entry to log file 'log.txt'");
    }
  }
}